{template '_header'}

<div class="page-header">当前位置：<span class="text-primary">资金管理</span></div>

<div class="page-content">
<form action="./index.php" method="get" class="form-horizontal" role="form" id="form1">
    <input type="hidden" name="c" value="site" />
    <input type="hidden" name="a" value="entry" />
    <input type="hidden" name="m" value="mx_shop" />
    <input type="hidden" name="do" value="web" />
    <input type="hidden" name="r" value="sorder.commission" />

    <div class="page-toolbar">

        <div class="col-sm-3">
            <div class="btn-group btn-group-sm" style='float:left'>
                <button class="btn btn-default btn-sm"  type="button" data-toggle='refresh'><i class='fa fa-refresh'></i></button>

                <!--技术佣金: <span class='text-danger'>{php echo number_format($reserved['jishu'],2)}</span> &nbsp;-->
                <!--奖金池佣金: <span class='text-danger'>{php echo number_format($reserved['jiangjin'],2)}</span> &nbsp;-->
                <!--遗留佣金: <span class='text-danger'>{php echo number_format($reserved['remain'],2)}</span>-->
            </div>
        </div>

        <div class="col-sm-4">
            <div class="input-group">
                <div class="input-group-select">
                    <select name='searchtime'  class='form-control  input-sm select-md'   style="width:120px;padding:0 5px;"  >
                        <option value=''>不按时间</option>
                        <option value='create' {if $_GPC['searchtime']==''}selected{/if}>创建时间</option>
                    </select>

                    {php echo tpl_form_field_daterange('time', array('starttime'=>date('Y-m-d H:i', $starttime),'endtime'=>date('Y-m-d H:i', $endtime)),true);}
                </div>
            </div>
        </div>

        <div class="col-sm-4 pull-right">
            <div class="input-group">
                <div class="input-group-select">
                    <select name='searchfield' class='form-control  input-sm select-md' style="width:120px;"  >
                        <option value="member" {if $_GPC['searchfield']=='member'}selected{/if}>会员信息</option>
                        <option value="mendian" {if $_GPC['searchfield']=='mendian'}selected{/if}>门店名称</option>
                    </select>
                </div>
                <input type="text" class="form-control input-sm"  name="keyword" value="{$_GPC['keyword']}" placeholder="请输入关键词"/>
                <span class="input-group-btn">
                    <button class="btn btn-sm btn-primary" type="submit"> 搜索</button>
                </span>
            </div>
        </div>
    </div>
</form>
{if !empty($list)}

<table class="table table-hover table-responsive">
    <thead class="navbar-inner" >
    <tr style='background:#f8f8f8'>
        <td style='width:100px;border-left:1px solid #f2f2f2;'>会员/门店名称</td>
        <td style='width:100px;'>会员头像</td>
        <td style='width:100px;text-align: right;;'>累计佣金(元)</td>
        <td  style='width:100px;text-align: center;'>剩余佣金(元)</td>
        <td style='width:120px;text-align: center;'>已提现佣金(元)</td>
        <td style='width:120px;text-align: center;'>提现冻结佣金(元)</td>
        <td style='width:100px;text-align: center;'>创建时间</td>
        <td style='width:90px;text-align: center'>操作</td>
    </tr>
    </thead>
    <tbody>
    {loop $list $item}
    <tr class='trbody'>
        {if $item['type'] == 1}
            <td>
                {ifp 'member.list.view'}
                <a href="{php echo webUrl('member/list/detail',array('id'=>$item['mid']))}" target='_blank'>{$item['realname']}</a>
                {else}
                {$item['realname']}
                {/if}
            </td>
            <td><img src="{php echo tomedia($item['avatar'])}" style='width:50px;height:50px;border:1px solid #ccc; padding:1px;'></td>
        {/if}
        {if $item['type'] == 2}
            <td>
                {ifp 'mendian.main'}
                <a href="{php echo webUrl('mendian',array('keyword'=>$item['mendianname']))}" target='_blank'>{$item['mendianname']}</a>
                {else}
                {$item['mendianname']}
                {/if}
            </td>
            <td><img src="{php echo tomedia($item['thumb'])}" style='width:50px;height:50px;border:1px solid #ccc; padding:1px;'></td>
        {/if}
            <td style="text-align: center;">{$item['total']}</td>
            <td style="text-align: center;">{$item['remain']}</td>
            <td style="text-align: center;">{$item['drawal']}</td>
            <td style="text-align: center;">{$item['freeze']}</td>
            <td style="text-align: center;">{php echo date('Y-m-d',$item['createtime'])}<br/>{php echo date('H:i:s',$item['createtime'])}</td>
        <td    class='ops' style='line-height:20px;text-align:center;overflow:visible;' >
            <div class="btn-group btn-group-sm" >
                <a class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false" href="javascript:;">操作 <span class="caret"></span></a>
                <ul class="dropdown-menu dropdown-menu-left" role="menu" style='z-index: 9999'>

                    {if $item['type'] == 1}
                        {ifp 'member.list.detail'}
                        <li><a href="{php echo webUrl('member/list/detail',array('id' => $row['mid']));}" title="会员详情"><i class='fa fa-edit'></i> 会员详情</a></li>
                        {/if}
                    {else}
                        {ifp 'mendian.main'}
                        <li><a href="{php echo webUrl('mendian',array('keyword'=>$item['mendianname']))}" title='门店详情'><i class='fa fa-edit'></i> 门店详情</a></li>
                        {/if}
                    {/if}
                    {ifp 'sorder.commission.commlog'}
                        <li><a href="{php echo webUrl('sorder/commission/commlog',array('id'=>$item['id']))}" title='佣金明细'><i class='fa fa-list'></i> 佣金明细</a></li>
                    {/if}
                </ul>
            </div>
        </td>
    </tr>

    <tr style=";border-bottom:none;background:#f9f9f9;">
        <td colspan="4" style="text-align:left">
        </td>
        <td colspan="4" style="text-align:right">
        </td>
    </tr>
    {/loop}
    </tbody>
</table>
{$pager}

    {else}
    <div class="panel panel-default">
        <div class="panel-body empty-data">未查询到相关数据</div>
    </div>
    {/if}
</div>
<script language="javascript">

    $('.daterange').attr('class','btn btn-default daterange daterange-time btn-sm');
    require(['bootstrap'],function(){
        $("[rel=pop]").popover({
            trigger:'manual',
            placement : 'left',
            title : $(this).data('title'),
            html: 'true',
            content : $(this).data('content'),
            animation: false
        }).on("mouseenter", function () {
            var _this = this;
            $(this).popover("show");
            $(this).siblings(".popover").on("mouseleave", function () {
                $(_this).popover('hide');
            });
        }).on("mouseleave", function () {
            var _this = this;
            setTimeout(function () {
                if (!$(".popover:hover").length) {
                    $(_this).popover("hide")
                }
            }, 100);
        });
    });


</script>

{template '_footer'}